package Net;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class demo1 {
    public static void main(String[] args) throws IOException {
        InetAddress inetAddress = InetAddress.getLocalHost();
        System.out.println(inetAddress.getHostName());
        System.out.println(inetAddress.getHostAddress());

        InetAddress inetAddress1 = InetAddress.getByName("www.bilibili.com");
        System.out.println(inetAddress1.getHostName());
        System.out.println(inetAddress1.getHostAddress());

        System.out.println(inetAddress1.isReachable(6000));
    }

}
